from django.db import models


# 用户表
class User(models.Model):
    u_name = models.CharField(verbose_name='昵称', max_length=64, null=True)
    password = models.CharField(verbose_name='密码', max_length=16, null=True)
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True, null=True)

    u_photo = models.ImageField(verbose_name="头像图片", default="/static/img/profile.png")
    u_cha = models.CharField(verbose_name="特征", max_length=32, null=True)
    u_follow = models.IntegerField(verbose_name="关注", null=True, default=0)
    u_fans = models.IntegerField(verbose_name="粉丝", null=True, default=0)

# 帖子表
class Topic(models.Model):
    t_uid = models.IntegerField(verbose_name='帖子所属用户id')
    t_uname = models.CharField(verbose_name='帖子所属用户昵称', max_length=64, null=True)
    t_ucha = models.CharField(verbose_name="帖子所属用户特征", max_length=32, null=True)
    create_time = models.DateTimeField(verbose_name='创建时间', auto_now_add=True)
    t_uphoto = models.ImageField(verbose_name="头像图片", default="/static/img/profile.png")

    t_photo = models.ImageField(verbose_name='帖子图片', null=True)
    t_content = models.CharField(verbose_name='帖子正文', max_length=3000)

    t_like = models.IntegerField(verbose_name="点赞数", default=0)
    t_comment = models.IntegerField(verbose_name="评论数", default=0)
    t_share = models.IntegerField(verbose_name="转发数", default=0)
    t_chaohua = models.CharField(verbose_name='帖子超话', max_length=30, default='日常')

# 回复表
class Reply(models.Model):
    r_tid = models.IntegerField(verbose_name='回复的帖子id')
    r_uid = models.IntegerField(verbose_name='回复者id')
    r_uname = models.CharField(verbose_name='发表者昵称', max_length=64, null=True)
    r_photo = models.CharField(verbose_name='回复的图片', max_length=128, null=True)
    r_time = models.DateField(verbose_name='留言时间', auto_now_add=True)
    r_content = models.CharField(verbose_name='回复内容', max_length=256)

#关注表
class Follow(models.Model):
    uid = models.IntegerField(verbose_name='我的id')
    f_name = models.CharField(verbose_name='关注人昵称', max_length=64, null=True)
    f_time = models.DateTimeField(verbose_name='关注时间', auto_now_add=True, null=True)
    f_photo = models.ImageField(verbose_name="关注人头像", default="/static/img/profile.png")
    f_cha = models.CharField(verbose_name="关注人特征", max_length=32, null=True)

#粉丝表
class Fans(models.Model):
    uid = models.IntegerField(verbose_name='我的id')
    fa_name = models.CharField(verbose_name='关注人昵称', max_length=64, null=True)
    fa_photo = models.ImageField(verbose_name="关注人头像", default="/static/img/profile.png")
    fa_cha = models.CharField(verbose_name="关注人特征", max_length=32, null=True)